package cc.git.liuyan.customeraiagent.core.embeddingmodel;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

public class UrlUtil {

    public static InputStream getUrlInputStream(String url) {
        InputStream inputStream = null;
        try {
            inputStream = new URL(url).openStream();
            return inputStream;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void closeUrlInputStream(InputStream inputStream) {
        if (inputStream != null) {
            try {
                inputStream.close();
                inputStream = null;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
